package org.rcloud.io.mapper;

import com.alibaba.fastjson.JSONObject;
import org.rcloud.io.Utils.LikeVo;
import org.rcloud.io.model.Article;
import org.springframework.stereotype.Repository;

import java.util.List;
import java.util.Map;

@Repository
public interface ArticleMapper {
    int deleteByPrimaryKey(Integer id);

    int insert(Article record);

    int insertSelective(Article record);

    Article selectByPrimaryKey(Integer id);

    Article selectByTitle(String nameTitle);

    int updateByPrimaryKeySelective(Article record);

    int updateByPrimaryKey(Article record);

    List<Article> findRuralNoBinding(Integer rId);

    List<Article> findRuralYesBinding(Integer rId);

    List<Article> findSpecialtyNoBinding(Integer bId);

    List<Article> findSpecialtyYesBinding(Integer bId);

    List<Article> selectAll(Map record);

    List<LikeVo> selectSum(Integer categoryId);

//    分页
//    List<Article> selectVoteNum(Map map);

    List<Article> selectVoteNum(JSONObject record);

    /**
     * 根据活动类型查询所有文章
     * @param categoryId
     * @return
     */
    List<LikeVo> selectByCategoryId(Integer categoryId);

    /**
     * 查询人员点赞过的图片
     * @param id
     * @return
     */
    List<LikeVo> selectByUserId(Integer id);

    /**
     * 根据id查询人员的所有作品
     * @param id
     * @return
     */
    List<LikeVo> selectAllByUserId(Integer id);

    /**
     * 查询上传个数
     * @param categoryId
     * @param uId
     * @return
     */
    int selectCount(Integer categoryId,Integer uId);


}